const path=require('path');
const HtmlWebpackPlugin=require('html-webpack-plugin');
module.exports={
    entry:{
        main:'./src/demo.js',
    },
    mode:'development',
    output:{
        path:path.resolve(__dirname,'./dist'),
        filename:"[name]_[hash].js"
    },
    // 可以让html中的数据加载出来
    plugins: [new HtmlWebpackPlugin({ template: "src/index.html" })],
    module:{
        rules:[{
            test:/\.css$/,
            use:["style-loader","css-loader"],
        },
        {
            test:/\.(png|jpe?g|gif)$/,
            use:{
                loader:"file-loader",
                options:{
                    name:"[name].[ext]",
                    outputPath:"images/"
                }
            }
        }
    ]
    }
}